package com.doge.controller.wx;

import com.doge.bean.base.BaseRespVo;
import com.doge.bean.bo.WxAddressDeleteBo;
import com.doge.bean.pojo.address.Address;
import com.doge.bean.vo.address.WxAddressListVo;
import com.doge.service.wx.address.WxAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: doge
 * @description: 地址
 * @author: Mr.Jiang
 * @create: 2021-12-02 22:27
 **/
@RestController
@RequestMapping("wx/address")
public class WxAddressController {
    @Autowired
    WxAddressService wxAddressService;
    @RequestMapping("list")
    public BaseRespVo list(){
        WxAddressListVo wxAddressListVo=wxAddressService.list();
        return BaseRespVo.ok(wxAddressListVo);
    }
    @RequestMapping("detail")
    public BaseRespVo detail(Integer id){
        Address address=wxAddressService.detail(id);
        return BaseRespVo.ok(address);
    }
    @RequestMapping("save")
    public BaseRespVo save(@RequestBody Address address){
        Integer id=wxAddressService.save(address);
        return BaseRespVo.ok(id);
    }
    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody WxAddressDeleteBo wxAddressDeleteBo){
        wxAddressService.delete(wxAddressDeleteBo.getId());
        return BaseRespVo.ok();
    }

}
